// pages/work1/stars/stars.js
Component({
    options: {
        multipleSlots: true
    },
    properties: {
        rate: {
            type: Number,
            value: 0
        },
        displayNum:{
            type:Boolean,
            value:true
        }
    },
    data:{
        rateText: "",
        lights: 0,
        halfs: 0,
        grays: 0
    },
    // lifetimes: {
    //     //生命周期函数
    //     attached: function () {
    //         let that = this //定义全局变量
    //         let rate = that.properties.rate
    //         //console.log(rate)
    //         //星星个数
    //         let lights = 'a'.repeat(Math.floor(rate / 2))
    //         //半个星星个数
    //         let halfs = rate % 2 != 0
    //         //灰色星星个数
    //         let grays = 'a'.repeat(Math.floor((10 - rate) / 2))
    //         let rateText = rate && rate > 0 ? rate.toFixed(1) : "未评分"
    //         that.setData({
    //             rateText: rateText,
    //             lights: lights,
    //             halfs: halfs,
    //             grays: grays,
    //         })
    //     },
    // },
})